---
title: "Difference-Splitting Voting: Middle-Ground Votes at the U.S.\ Supreme Court - Replication Code."
author: "Albert H. Rivero^[Assistant Professor of Politics and John L. Nau III Assistant Professor of the History and Principles of Democracy, University of Virginia.]"
date: ""
output: 
  pdf_document:
    fig_caption: yes
    fig_crop: false
    citation_package: natbib
    keep_tex: true
    number_sections: yes
fontsize: 12pt
documentclass: article
clean: true
---



```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(rms)

library(xtable)
library(tidyverse)

library(stargazer)
library(ggeffects)

library(readstata13)

library(acid)

library(readxl)
```

```{r, include=FALSE}
options(tinytex.verbose = TRUE)
```


```{r load, include = FALSE}
possible_compromise <- read_rds("Data/possible_compromise.rds")
scdb_Compromise <- read_rds("Data/scdb_Compromise.rds")
scdb_Predict_Opp <- read_rds("Data/scdb_Predict_Opp.rds")

week_dataset <- read_rds("Data/week_dataset.rds")
month_dataset <- read_rds("Data/month_dataset.rds")
term_dataset <- read_rds("Data/term_dataset.rds")

scdb_for_models_sal_b <- read_rds("Data/scdb_for_models_sal_b.rds")
scdb_sal_comp_b <- read_rds("Data/scdb_sal_comp_b.rds")
scdb_sal_b_nonunan <- read_rds("Data/scdb_sal_b_nonunan.rds")
scdb_for_models_bailey <- read_rds("Data/scdb_for_models_bailey.rds")
scdb_for_models_bailey_full <- read_rds("Data/scdb_for_models_bailey_full.rds")
withindocket_sal_b <- read_rds("Data/withindocket_sal_b.rds")
week_dataset_sal_b <- read_rds("Data/week_dataset_sal_b.rds")
month_dataset_sal_b <- read_rds("Data/month_dataset_sal_b.rds")
term_dataset_sal_b <- read_rds("Data/term_dataset_sal_b.rds")

scdb_for_models_sal_mq <- read_rds("Data/scdb_for_models_sal_mq.rds")
scdb_sal_comp_mq <- read_rds("Data/scdb_sal_comp_mq.rds")
scdb_sal_mq_nonunan <- read_rds("Data/scdb_sal_mq_nonunan.rds")
scdb_for_models_mq <- read_rds("Data/scdb_for_models_mq.rds")
scdb_for_models_mq_full <- read_rds("Data/scdb_for_models_mq_full.rds")
withindocket_sal_mq <- read_rds("Data/withindocket_sal_mq.rds")
week_dataset_sal_mq <- read_rds("Data/week_dataset_sal_mq.rds")
month_dataset_sal_mq <- read_rds("Data/month_dataset_sal_mq.rds")
term_dataset_sal_mq <- read_rds("Data/term_dataset_sal_mq.rds")

scdb_for_models_sal_sc <- read_rds("Data/scdb_for_models_sal_sc.rds")
scdb_sal_comp_sc <- read_rds("Data/scdb_sal_comp_sc.rds")
scdb_sal_sc_nonunan <- read_rds("Data/scdb_sal_sc_nonunan.rds")
scdb_for_models_sc <- read_rds("Data/scdb_for_models_sc.rds")
scdb_for_models_sc_full <- read_rds("Data/scdb_for_models_sc_full.rds")
withindocket_sal_sc <- read_rds("Data/withindocket_sal_sc.rds")
week_dataset_sal_sc <- read_rds("Data/week_dataset_sal_sc.rds")
month_dataset_sal_sc <- read_rds("Data/month_dataset_sal_sc.rds")
term_dataset_sal_sc <- read_rds("Data/term_dataset_sal_sc.rds")

```

Number of issue codes in my data: `r scdb_Compromise %>% count(issue) %>% nrow()`.

This process covers the `r scdb_Compromise %>% pull(term) %>% min()`--`r scdb_Compromise %>% pull(term) %>% max()` Terms and generates `r scdb_Compromise %>% nrow() %>% format(big.mark = ",")` votes in `r scdb_Compromise %>% pull(caseNames) %>% unique() %>% length() %>% format(big.mark = ",")` difference-splitting opportunities. In the regression models predicting *Difference-splitting vote*, we cover the `r scdb_for_models_sal_mq %>% pull(term) %>% min()`--`r scdb_for_models_sal_mq %>% pull(term) %>% max()` Terms, with `r scdb_for_models_sal_mq %>% nrow() %>% format(big.mark = ",")` votes in `r scdb_for_models_sal_mq %>% pull(caseNames) %>% unique() %>% length() %>% format(big.mark = ",")` difference-splitting opportunities. 

```{r descriptive, echo = FALSE, message = FALSE, fig.cap = "\\label{fig_possible}The potential for difference-splitting votes over time", fig.width = 5.625, fig.height = 3.75, dev = "postscript"}
# Percentage of date-issue votes where a compromise was possible (that is, there was more than one vote per justice in a date-issue)

poss_split1 <- possible_compromise %>% group_by(term) %>% summarize(diff_split_opp = sum(diff_split_opp), n = n()) %>%
    ggplot(aes(x = term, y = diff_split_opp)) + 
  geom_col(aes(y = n, color = "grey"), fill = "grey") +
  geom_col(aes(y = diff_split_opp, color = "black"), fill = "black") +
  scale_color_identity(name = "",
                       breaks = c("grey", "black"),
                       labels = c("Total date-issue combinations", "Difference-splitting opportunities"),
                       guide = "legend") +
  geom_vline(xintercept = 1988, linetype = "dashed") + ylab("Difference-splitting opportunities") + xlab("Term") + theme_minimal() + theme(legend.position = "bottom", legend.direction = "vertical")

poss_split2 <- possible_compromise %>% group_by(term) %>% summarize(diff_split_opp = mean(diff_split_opp), n = n()) %>%
    ggplot(aes(x = term, y = diff_split_opp)) + 
  geom_col(aes(color = "black"), fill = "black") +
  scale_color_identity(breaks = c("black")) +
  geom_vline(xintercept = 1988, linetype = "dashed") + ylab("Proportion") + xlab("Term") + theme_minimal() + ylim(c(0, 0.5))

library(patchwork)
poss_split1 + poss_split2
```

```{r descriptive_2, echo = FALSE, message = FALSE, fig.cap = "\\label{fig_actual}Actual difference-splitting votes over time, as a share of difference-splitting opportunities", fig.width = 5.625, fig.height = 3.75, dev = "postscript"}

split_votes1 <- scdb_Compromise %>%
  group_by(term) %>%
  summarize(n = n(),
            compromise = sum(compromise)) %>%
  ggplot(aes(x = term, y = compromise)) + 
  geom_col(aes(y = n, color = "grey"), fill = "grey") +
  geom_col(aes(y = compromise, color = "black"), fill = "black") +
  scale_color_identity(name = "",
                       breaks = c("grey", "black"),
                       labels = c("Total votes in difference-splitting opportunities", "Difference-splitting votes"),
                       guide = "legend") +
  geom_vline(xintercept = 1988, linetype = "dashed") +
  ylab("Difference-splitting votes") +
  xlab("Term") +
  theme_minimal() + 
  theme(legend.position = "bottom", legend.direction = "vertical")

split_votes2 <- scdb_Compromise %>%
  group_by(term) %>%
  summarize(n = n(),
            compromise = mean(compromise)) %>%
    ggplot(aes(x = term, y = compromise)) + 
  geom_col(aes(color = "black"), fill = "black") +
  scale_color_identity(breaks = c("black")) +
  geom_vline(xintercept = 1988, linetype = "dashed") + ylab("Proportion of votes") + xlab("Term") + theme_minimal() + ylim(c(0, 0.5)) 

split_votes1 + split_votes2
```

```{r proportions, echo = FALSE, message = FALSE, fig.cap = "\\label{proportions}Difference-splitting propensity by justice and Chief Justiceship, proportions with Wilson score confidence intervals. Overall average proportion across the whole dataset plotted with dashed lines.", dev = "postscript"}
props <- scdb_Compromise %>%
  mutate(justiceName = ifelse(justiceName=="WHRehnquist" & chief=="Rehnquist", "WHRehnquist (Chief)",justiceName)) %>%
  rename(Name = justiceName) %>%
    mutate(Name = case_when(Name == "ACBarrett" ~ "Amy Coney Barrett",
                          Name == "AFortas" ~ "Abe Fortas",
                          Name == "AJGoldberg" ~ "Arthur Goldberg",
                          Name == "AMKennedy" ~ "Anthony Kennedy",
                          Name == "AScalia" ~ "Antonin Scalia",
                          Name == "BMKavanaugh" ~ "Brett Kavanaugh",
                          Name == "BRWhite" ~ "Byron White",
                          Name == "CEWhittaker" ~ "Charles Evans Whittaker",
                          Name == "CThomas" ~ "Clarence Thomas",
                          Name == "DHSouter" ~ "David Souter",
                          Name == "EKagan" ~ "Elena Kagan",
                          Name == "EWarren" ~ "Earl Warren",
                          Name == "FFrankfurter" ~ "Felix Frankfurter",
                          Name == "FMurphy" ~ "Frank Murphy",
                          Name == "FMVinson" ~ "Fred M. Vinson",
                          Name == "HABlackmun" ~ "Harry Blackmun",
                          Name == "HHBurton" ~ "Harold Burton",
                          Name == "HLBlack" ~ "Hugo Black",
                          Name == "JHarlan2" ~ "John Marshall Harlan II",
                          Name == "JPStevens" ~ "John Paul Stevens",
                          Name == "JGRoberts" ~ "John Roberts",
                          Name == "KBJackson" ~ "Ketanji Brown Jackson",
                          Name == "LFPowell" ~ "Lewis F. Powell, Jr.",
                          Name == "NMGorsuch" ~ "Neil Gorsuch",
                          Name == "PStewart" ~ "Potter Stewart",
                          Name == "RBGinsburg" ~ "Ruth Bader Ginsburg",
                          Name == "RHJackson" ~ "Robert Jackson",
                          Name == "SAAlito" ~ "Samuel Alito",
                          Name == "SDOConnor" ~ "Sandra Day O'Connor",
                          Name == "SFReed" ~ "Stanley Forman Reed",
                          Name == "SGBreyer" ~ "Stephen Breyer",
                          Name == "SMinton" ~ "Sherman Minton",
                          Name == "SSotomayor" ~ "Sonia Sotomayor",
                          Name == "TCClark" ~ "Tom C. Clark",
                          Name == "TMarshall" ~ "Thurgood Marshall",
                          Name == "WBRutledge" ~ "Wiley B. Rutledge",
                          Name == "WEBurger" ~ "Warren Burger",
                          Name == "WHRehnquist (Chief)" ~ "William Rehnquist (Chief)",
                          Name == "WHRehnquist" ~ "William Rehnquist (Associate)",
                          Name == "WJBrennan" ~ "William Brennan",
                          Name == "WODouglas" ~ "William O. Douglas",
                          TRUE ~ Name)) %>%
  group_by(chief, Name) %>%
  summarize(X = sum(compromise), N = n(),
            .groups = "drop")

split_scores <- Hmisc::binconf(props$X, props$N, method = "wilson", include.x = TRUE, include.n = TRUE, return.df = TRUE) %>% mutate(chief = props$chief, Name = props$Name)

overall_mean <- scdb_Compromise %>% pull(compromise) %>% mean()

warren_figure <- split_scores %>% 
  filter(N >= 30) %>%
  select(`Difference-Splitting Propensity` = PointEst, Lower, Upper, Name, Chief = chief) %>%
  filter(Chief == "Warren") %>%
  mutate(Name = fct_reorder(Name, `Difference-Splitting Propensity`)) %>%
  ggplot(aes(x = Name, y = `Difference-Splitting Propensity`, ymin = Lower, ymax = Upper)) +
  ggtitle("Warren") +
  geom_point() +
  geom_linerange() +
  xlab("") +
  ylab("") +
  geom_hline(yintercept = overall_mean, linetype = "dashed") +
  ylim(c(0, 0.315)) +
  coord_flip() +
  theme_minimal()

burger_figure <- split_scores %>% 
  filter(N >= 30) %>%
  select(`Difference-Splitting Propensity` = PointEst, Lower, Upper, Name, Chief = chief) %>%
  filter(Chief == "Burger") %>%
  mutate(Name = fct_reorder(Name, `Difference-Splitting Propensity`)) %>%
  ggplot(aes(x = Name, y = `Difference-Splitting Propensity`, ymin = Lower, ymax = Upper)) +
  ggtitle("Burger") +
  geom_point() +
  geom_linerange() +
  xlab("") +
  ylab("") +
  geom_hline(yintercept = overall_mean, linetype = "dashed") +
  ylim(c(0, 0.315)) +
  coord_flip() +
  theme_minimal()

rehnquist_figure <- split_scores %>% 
  filter(N >= 30) %>%
  select(`Difference-Splitting Propensity` = PointEst, Lower, Upper, Name, Chief = chief) %>%
  filter(Chief == "Rehnquist") %>%
  mutate(Name = fct_reorder(Name, `Difference-Splitting Propensity`)) %>%
  ggplot(aes(x = Name, y = `Difference-Splitting Propensity`, ymin = Lower, ymax = Upper)) +
  ggtitle("Rehnquist") +
  geom_point() +
  geom_linerange() +
  xlab("") +
  geom_hline(yintercept = overall_mean, linetype = "dashed") +
  ylim(c(0, 0.315)) +
  coord_flip() +
  theme_minimal() +
  theme(axis.title.x = element_text(hjust = 1))

roberts_figure <- split_scores %>% 
  filter(N >= 30) %>%
  select(`Difference-Splitting Propensity` = PointEst, Lower, Upper, Name, Chief = chief) %>%
  filter(Chief == "Roberts") %>%
  mutate(Name = fct_reorder(Name, `Difference-Splitting Propensity`)) %>%
  ggplot(aes(x = Name, y = `Difference-Splitting Propensity`, ymin = Lower, ymax = Upper)) +
  ggtitle("Roberts") +
  geom_point() +
  geom_linerange() +
  xlab("") +
#  ylab("") +
  geom_hline(yintercept = overall_mean, linetype = "dashed") +
  ylim(c(0, 0.315)) +
  coord_flip() +
  theme_minimal() +
  theme(axis.title.x = element_text(hjust = 1))


warren_figure + burger_figure + rehnquist_figure + roberts_figure
```

The overall mean proportion  is `r overall_mean %>% round(2)`.



```{r opportunity_model, echo = FALSE, results = "asis"}

opportunity_pred <- lm(diff_split_opp ~ caseload + post_judiciary_act + pol_mq + logisticbills, 
           data = scdb_Predict_Opp)

stargazer(opportunity_pred,
          digits = 2,
          style = "apsr",
          keep.stat = c("n", "adj.rsq"),
          covariate.labels = c("Caseload",
                               "After Case Selections Act",
                               "Court polarization",
                               "Court curbing bills, t-1"),
          dep.var.labels = "Difference-splitting opportunities",
                    header = FALSE,
          title = "Predicting difference-splitting opportunities by year, OLS model",
          label = "opportunity_model")
```

```{r run_models_2, echo = FALSE, message = FALSE, cache = FALSE}


scdb_for_models_sal_b <- scdb_for_models_sal_b %>% select(-term)

bailey_orig <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_sal_b, x = TRUE, y = TRUE, maxit = 1000)
bailey <- robcov(bailey_orig, cluster = scdb_for_models_sal_b$date_issue)

bailey_orig_complex <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + maxComplexity + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_sal_comp_b, x = TRUE, y = TRUE, maxit = 1000)
bailey_c <- robcov(bailey_orig_complex, cluster = scdb_sal_comp_b$date_issue)


bailey_orig_nonunan <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_sal_b_nonunan, x = TRUE, y = TRUE, maxit = 1000)
bailey_n <- robcov(bailey_orig_nonunan, cluster = scdb_sal_b_nonunan$date_issue)

bailey_orig_termvar <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + log_caseload + post_judiciary_act + logbills + polar + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_sal_b, x = TRUE, y = TRUE, maxit = 1000)
bailey_t <- robcov(bailey_orig_termvar, cluster = scdb_for_models_sal_b$date_issue)


bailey_orig_long <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + term_factor + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_bailey, x = TRUE, y = TRUE, maxit = 1000)
bailey_l <- robcov(bailey_orig_long, cluster = scdb_for_models_bailey$date_issue)

bailey_orig_verylong <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + term_factor + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_bailey_full, x = TRUE, y = TRUE, maxit = 1000)
bailey_vl <- robcov(bailey_orig_verylong, cluster = scdb_for_models_bailey_full$date_issue)

bailey_orig_wd <- lrm(compromise ~ lc_split_dir + multiple_cases + multiple_dockets + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = withindocket_sal_b, x = TRUE, y = TRUE, maxit = 1000)
bailey_wd <- robcov(bailey_orig_wd, cluster = withindocket_sal_b$date_issue)

bailey_orig_week <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = week_dataset_sal_b, x = TRUE, y = TRUE, maxit = 1000)
bailey_week <- robcov(bailey_orig_week, cluster = week_dataset_sal_b$week_issue)

bailey_orig_month <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = month_dataset_sal_b, x = TRUE, y = TRUE, maxit = 1000)
bailey_month <- robcov(bailey_orig_month, cluster = month_dataset_sal_b$month_issue)

bailey_orig_term <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = term_dataset_sal_b, x = TRUE, y = TRUE, maxit = 1000)
bailey_term <- robcov(bailey_orig_term, cluster = term_dataset_sal_b$term_issue)

mq_orig <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_sal_mq, x = TRUE, y = TRUE, maxit = 1000)
mq <- robcov(mq_orig, cluster = scdb_for_models_sal_mq$date_issue)

mq_orig_complex <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + maxComplexity + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_sal_comp_mq, x = TRUE, y = TRUE, maxit = 1000)
mq_c <- robcov(mq_orig_complex, cluster = scdb_sal_comp_mq$date_issue)

mq_orig_nonunan <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_sal_mq_nonunan, x = TRUE, y = TRUE, maxit = 1000)
mq_n <- robcov(mq_orig_nonunan, cluster = scdb_sal_mq_nonunan$date_issue)

mq_orig_termvar <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + log_caseload + post_judiciary_act + logbills + polar + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_sal_mq, x = TRUE, y = TRUE, maxit = 1000)
mq_t <- robcov(mq_orig_termvar, cluster = scdb_for_models_sal_mq$date_issue)

mq_orig_long <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + term_factor + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_mq, x = TRUE, y = TRUE, maxit = 1000)
mq_l <- robcov(mq_orig_long, cluster = scdb_for_models_mq$date_issue)

mq_orig_verylong <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + term_factor + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_mq_full, x = TRUE, y = TRUE, maxit = 1000)
mq_vl <- robcov(mq_orig_verylong, cluster = scdb_for_models_mq_full$date_issue)

mq_orig_wd <- lrm(compromise ~ lc_split_dir + multiple_cases + multiple_dockets + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = withindocket_sal_mq, x = TRUE, y = TRUE, maxit = 1000)
mq_wd <- robcov(mq_orig_wd, cluster = withindocket_sal_mq$date_issue)

mq_orig_week <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = week_dataset_sal_mq, x = TRUE, y = TRUE, maxit = 1000)
mq_week <- robcov(mq_orig_week, cluster = week_dataset_sal_mq$week_issue)

mq_orig_month <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = month_dataset_sal_mq, x = TRUE, y = TRUE, maxit = 1000)
mq_month <- robcov(mq_orig_month, cluster = month_dataset_sal_mq$month_issue)

mq_orig_term <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = term_dataset_sal_mq, x = TRUE, y = TRUE, maxit = 1000)
mq_term <- robcov(mq_orig_term, cluster = term_dataset_sal_mq$term_issue)

sc_orig <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_sal_sc, x = TRUE, y = TRUE, maxit = 1000)
sc <- robcov(sc_orig, cluster = scdb_for_models_sal_sc$date_issue)

sc_orig_complex <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + maxComplexity + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_sal_comp_sc, x = TRUE, y = TRUE, maxit = 1000)
sc_c <- robcov(sc_orig_complex, cluster = scdb_sal_comp_sc$date_issue)


sc_orig_nonunan <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_sal_sc_nonunan, x = TRUE, y = TRUE, maxit = 1000)
sc_n <- robcov(sc_orig_nonunan, cluster = scdb_sal_sc_nonunan$date_issue)

sc_orig_termvar <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + log_caseload + post_judiciary_act + logbills + polar + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_sal_sc, x = TRUE, y = TRUE, maxit = 1000)
sc_t <- robcov(sc_orig_termvar, cluster = scdb_for_models_sal_sc$date_issue)

sc_orig_long <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + term_factor + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_sc, x = TRUE, y = TRUE, maxit = 1000)
sc_l <- robcov(sc_orig_long, cluster = scdb_for_models_sc$date_issue)


sc_orig_verylong <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + term_factor + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = scdb_for_models_sc_full, x = TRUE, y = TRUE, maxit = 1000)
sc_vl <- robcov(sc_orig_verylong, cluster = scdb_for_models_sc_full$date_issue)

sc_orig_wd <- lrm(compromise ~ lc_split_dir + multiple_cases + multiple_dockets + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = withindocket_sal_sc, x = TRUE, y = TRUE, maxit = 1000)
sc_wd <- robcov(sc_orig_wd, cluster = withindocket_sal_sc$date_issue)

sc_orig_week <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = week_dataset_sal_sc, x = TRUE, y = TRUE, maxit = 1000)
sc_week <- robcov(sc_orig_week, cluster = week_dataset_sal_sc$week_issue)

sc_orig_month <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = month_dataset_sal_sc, x = TRUE, y = TRUE, maxit = 1000)
sc_month <- robcov(sc_orig_month, cluster = month_dataset_sal_sc$month_issue)

sc_orig_term <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + issueArea + term_factor + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief, data = term_dataset_sal_sc, x = TRUE, y = TRUE, maxit = 1000)
sc_term <- robcov(sc_orig_term, cluster = term_dataset_sal_sc$term_issue)

my_mods <- list(bailey, mq, sc)
my_mods_t <- list(bailey_t, mq_t, sc_t)
my_mods_l <- list(bailey_l, mq_l, sc_l)
my_mods_vl <- list(bailey_vl, mq_vl, sc_vl)
my_mods_n <- list(bailey_n, mq_n, sc_n)
my_mods_c <- list(bailey_c, mq_c, sc_c)
my_mods_wd <- list(bailey_wd, mq_wd, sc_wd)
my_mods_week <- list(bailey_week, mq_week, sc_week)
my_mods_month <- list(bailey_month, mq_month, sc_month)
my_mods_term <- list(bailey_term, mq_term, sc_term)
```

```{r tables, include = FALSE}

table_2 <- stargazer(my_mods,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult", "sal_cat", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
            covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_sal",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods[[1]]), 2), round(AIC(my_mods[[2]]), 2), round(AIC(my_mods[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)

```




```{r run_models_fes, echo = FALSE, message = FALSE}


library(lfe)
felm1 <- felm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief | term_factor + issueArea | 0 | date_issue, data = scdb_for_models_sal_b)

felm2 <- felm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme + is_chief | term_factor + issue | 0 | date_issue, data = scdb_for_models_sal_b)


felm3 <- felm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + extreme | justiceName + term_factor + issue | 0 | date_issue, data = scdb_for_models_sal_b, exactDOF = TRUE)


```

```{r run_mods_inter, echo = FALSE, message = FALSE}
bailey_inter_orig <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + term_factor + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme * is_median + is_chief, data = scdb_for_models_sal_b, x = TRUE, y = TRUE, maxit = 1000)
bailey_inter <- robcov(bailey_inter_orig, cluster = scdb_for_models_sal_b$date_issue)

mq_inter_orig <- lrm(compromise ~ lc_split_dir + multiple_cases + lc_mixed_mult + sal_cat + term_factor + issueArea + openPI + consciPI + extraPI + agreePI + neuroPI + qual + time_on_bench + extreme * is_median + is_chief, data = scdb_for_models_sal_mq, x = TRUE, y = TRUE, maxit = 1000)
mq_inter <- robcov(mq_inter_orig, cluster = scdb_for_models_sal_mq$date_issue)

inter_mods <- list(bailey_inter, mq_inter)


```

```{r model_sal, echo = FALSE, message = FALSE, results = "asis"}

cat(table_2[1:25], "\\hline", table_2[26:34], sep = '\n')
```

```{r plotpreds, echo = FALSE, message = FALSE, warning = FALSE, fig.width = 6, fig.height = 6, fig.align = "center", fig.cap =  "\\label{plot_preds}Predicted probabilities of casting a difference-splitting vote by key covariates", dev = "jpeg", fig.retina = 2}
plotpreds1 <- predict_response(model = bailey, terms = c("qual"), margin = "empirical") %>% plot() + ylim(c(0, 0.15)) + ggtitle("") + xlab("Qualifications") + ylab("Difference-splitting vote")
plotpreds2 <- predict_response(model = bailey, terms = c("consciPI"), margin = "empirical") %>% plot() + ylim(c(0, 0.15)) + ggtitle("") + xlab("Conscientiousness") + ylab("")
plotpreds3 <- predict_response(model = bailey, terms = c("extreme"), margin = "empirical") %>% plot() + ylim(c(0, 0.15)) + ggtitle("") + xlab("Extremity") + ylab("Difference-splitting vote")
plotpreds4 <- predict_response(model = bailey, terms = c("sal_cat"), margin = "empirical") %>% plot() + ylim(c(0, 0.15)) + ggtitle("") + xlab("Salience") + ylab("")
plotpreds1 + plotpreds2 + plotpreds3 + plotpreds4 
```



The rates of difference-splitting voting for those difference-splitting opportunities that exist in the expanded datasets but not the original one are very high: `r term_dataset %>% filter(! caseIds %in% scdb_Compromise$caseIds) %>% summarize(compromise = mean(compromise)) %>% pull(compromise) %>% scales::percent()` (same term), `r month_dataset %>% filter(! caseIds %in% scdb_Compromise$caseIds) %>% summarize(compromise = mean(compromise)) %>% pull(compromise) %>% scales::percent()` (same month), `r week_dataset %>% filter(! caseIds %in% scdb_Compromise$caseIds) %>% summarize(compromise = mean(compromise)) %>% pull(compromise) %>% scales::percent()` (same week), compared to `r scdb_Compromise %>% summarize(compromise = mean(compromise)) %>% pull(compromise) %>% scales::percent()`.

\clearpage

\newpage
\appendix
\renewcommand{\appendixname}{Online Appendix}
\renewcommand{\thepage}{A -- \arabic{page}}
\numberwithin{table}{section}
\numberwithin{figure}{section}

\setcounter{page}{1}

# Robustness checks and additional analyses

## Testing median status

```{r model_inter, echo = FALSE, message = FALSE, results = "asis"}

stargazer(inter_mods,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult",  "sal_cat", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "median", "is_chief"),
           covariate.labels = c("L.C. mixed directionality", "Multiple case captions",  "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Median justice", "Chief Justice", "Extreme $\\times$ Median"),
          header = FALSE,
          label = "results_inter",
                    title = "Predicting difference-splitting votes as a function of case-level, temporal, and justice-level factors, with an interaction between extremity and median status. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(inter_mods[[1]]), 2), round(AIC(inter_mods[[2]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ"),
         # font.size = "small",
         single.row = TRUE)


```

\clearpage

## Linear fixed effects models

```{r model_felm, echo = FALSE, message = FALSE, results = "asis"}

stargazer(felm1, felm2, felm3,
                     covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_felm",
                    title = "Linear fixed effects models predicting difference-splitting votes as a function of case-level and justice-level factors. Ideology measured using Bailey scores. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "",  ""),
                                     c("Issue FEs", "", "\\checkmark",  "\\checkmark"),
                                                                          c("Term FEs", "\\checkmark", "\\checkmark",  "\\checkmark"),
                                                                                                               c("Justice FEs", "", "",  "\\checkmark")
                           ),
          keep.stat = c("n", "adj.rsq"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
#          column.labels = c("Bailey", "MQ", "Segal-Cover"),
       #   font.size = "small",
         single.row = TRUE)
```

\clearpage

## With term-level variables

```{r model_term, echo = FALSE, message = FALSE, results = "asis"}

stargazer(my_mods_t,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult", "sal_cat", "log_caseload", "post_judiciary_act", "logbills", "polar", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
            covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "ln(Caseload)", "After Case Selections Act", "Court curbing bills, t-1", "Court polarization", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_term",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods_t[[1]]), 2), round(AIC(my_mods_t[[2]]), 2), round(AIC(my_mods_t[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)
```

\clearpage

## Models limited to cases that are not unanimous with respect to difference-splitting

```{r model_nonunan, echo = FALSE, message = FALSE, results = "asis"}

stargazer(my_mods_n,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult", "sal_cat", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
           covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_nonunan",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods_n[[1]]), 2), round(AIC(my_mods_n[[2]]), 2), round(AIC(my_mods_n[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)
```

\clearpage

## With case complexity

```{r model_complexity, echo = FALSE, message = FALSE, results = "asis"}

stargazer(my_mods_c,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult", "sal_cat", "maxComplexity", "post_judiciary_act", "logbills", "polar", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
           covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "Case complexity", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_complexity",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods_c[[1]]), 2), round(AIC(my_mods_c[[2]]), 2), round(AIC(my_mods_c[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)
```

\clearpage

## Longer time frames (including cases without a salience measure)

```{r model_nosal, echo = FALSE, message = FALSE, results = "asis"}

stargazer(my_mods_l,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult", "post_judiciary_act", "logbills", "polar", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
           covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_nosal",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors. Data from the 1955--2016 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods_l[[1]]), 2), round(AIC(my_mods_l[[2]]), 2), round(AIC(my_mods_l[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)
```

```{r model_nosal2, echo = FALSE, message = FALSE, results = "asis"}

stargazer(my_mods_vl,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult", "post_judiciary_act", "logbills", "polar", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
          covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_nosal2",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors. Data from the 1946--2016 Terms (MQ and Segal-Cover) or 1950--2016 Term (Bailey).",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods_vl[[1]]), 2), round(AIC(my_mods_vl[[2]]), 2), round(AIC(my_mods_vl[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)
```

\clearpage

## Redefinitions of "difference-splitting vote"

```{r table_wd, echo = FALSE, message = FALSE, results = "asis"}

wd_tab <- stargazer(my_mods_wd,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "multiple_dockets", "lc_mixed_mult", "sal_cat", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
            covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "Multiple dockets", "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_wd",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors, allowing for within-docket difference-splitting votes. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods_wd[[1]]), 2), round(AIC(my_mods_wd[[2]]), 2), round(AIC(my_mods_wd[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)

```

\clearpage

```{r table_week, echo = FALSE, message = FALSE, results = "asis"}

stargazer(my_mods_week,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult", "sal_cat", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
            covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_week",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors, definining opportunites at the decision week level. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods_week[[1]]), 2), round(AIC(my_mods_week[[2]]), 2), round(AIC(my_mods_week[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)

```

\clearpage



```{r table_month, echo = FALSE, message = FALSE, results = "asis"}

stargazer(my_mods_month,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult", "sal_cat", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
            covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_month",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors, definining opportunites at the decision month level. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods_month[[1]]), 2), round(AIC(my_mods_month[[2]]), 2), round(AIC(my_mods_month[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)

```

\clearpage

```{r table_term, echo = FALSE, message = FALSE, results = "asis"}

stargazer(my_mods_term,
          keep = c("Constant", "lc_split_dir", "multiple_cases", "lc_mixed_mult", "sal_cat", "openPI", "consciPI", "extraPI", "agreePI", "neuroPI", "qual", "time_on_bench", "extreme", "is_chief"),
            covariate.labels = c("L.C. mixed directionality", "Multiple case captions", "L.C. mixed $\\times$ Multiple captions",  "Medium salience case", "High salience case", "Openness", "Conscientiousness", "Extraversion", "Agreeableness", "Neuroticism", "Qualifications", "ln(Time on bench)", "Ideological extremity", "Chief Justice"),
          header = FALSE,
          label = "results_termmod",
                    title = "Logistic regressions predicting difference-splitting votes as a function of case-level and justice-level factors, definining opportunites at the term level. Data from the 1955--2008 Terms.",
                    add.lines = list(c("Opportunity-Clustered SEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Issue Area FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("Term FEs", "\\checkmark", "\\checkmark", "\\checkmark"),
                                     c("AIC", round(AIC(my_mods_term[[1]]), 2), round(AIC(my_mods_term[[2]]), 2), round(AIC(my_mods_term[[3]]), 2))
                           ),
          keep.stat = c("n", "aic"),
          digits = 2,
          style = "APSR",
          dep.var.labels = "Difference-splitting vote",
          column.labels = c("Bailey", "MQ", "Segal-Cover"),
         # font.size = "small",
         single.row = TRUE)

```

\clearpage